﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Scripting.Ast;

namespace Scala.Compiler.Ast
{
    public class ExpressionStatement:Statement
    {
        private readonly Expression _expression;

        public ExpressionStatement(Expression expression)
        {
            _expression = expression;
        }

        public Expression Expression
        {
            get { return _expression; }
        }

        public override void Walk(ScalaWalker walker)
        {
            if (walker.Walk(this))
            {
                if (_expression != null)
                {
                    _expression.Walk(walker);
                }
            }
            walker.PostWalk(this);
        }

        public override Microsoft.Scripting.Ast.Expression Reduce()
        {
            return Expression.Reduce();
        }
    }
}
